

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Getting Started with XlsxWriter &mdash; XlsxWriter Readme</title>
    
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '0.3.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="XlsxWriter Readme" href="index.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li><a href="#">XlsxWriter Readme</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="getting-started-with-xlsxwriter">
<h1>Getting Started with XlsxWriter</h1>
<p>Here are some easy instructions to get you up and running with the XlsxWriter
module.</p>
<div class="section" id="installing-xlsxwriter">
<h2>Installing XlsxWriter</h2>
<p>The first step is to install the XlsxWriter module. There are several ways to
do this.</p>
<div class="section" id="using-pip">
<h3>Using PIP</h3>
<p>The <a class="reference external" href="http://www.pip-installer.org/en/latest/index.html">pip</a>  installer is
the preferred method for installing Python modules from
<a class="reference external" href="http://pypi.python.org/pypi">PyPI</a>, the Python Package Index:</p>
<div class="highlight-python"><pre>$ sudo pip install XlsxWriter</pre>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Windows users can omit <tt class="docutils literal"><span class="pre">sudo</span></tt> at the start of the command.</p>
</div>
<div class="section" id="installing-from-a-tarball">
<h3>Installing from a tarball</h3>
<p>If you download a tarball of the latest version of XlsxWriter you can install
it as follows (change the version number to suit):</p>
<div class="highlight-python"><pre>$ tar -zxvf XlsxWriter-1.2.3.tar.gz

$ cd XlsxWriter-1.2.3
$ sudo python setup.py install</pre>
</div>
<p>A tarball of the latest code can be downloaded from GitHub as follows:</p>
<div class="highlight-python"><pre>$ curl -O -L http://github.com/jmcnamara/XlsxWriter/archive/master.tar.gz

$ tar zxvf master.tar.gz
$ cd XlsxWriter-master/
$ sudo python setup.py install</pre>
</div>
</div>
<div class="section" id="cloning-from-github">
<h3>Cloning from GitHub</h3>
<p>The XlsxWriter source code and bug tracker is in the
<a class="reference external" href="http://github.com/jmcnamara/XlsxWriter">XlsxWriter repository</a> on GitHub.
You can clone the repository and install from it as follows:</p>
<div class="highlight-python"><pre>$ git clone https://github.com/jmcnamara/XlsxWriter.git

$ cd XlsxWriter
$ sudo python setup.py install</pre>
</div>
</div>
</div>
<div class="section" id="running-a-sample-program">
<h2>Running a sample program</h2>
<p>If the installation went correctly you can create a small sample program like
the following to verify that the module works correctly:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="n">xlsxwriter</span>

<span class="n">workbook</span> <span class="o">=</span> <span class="n">xlsxwriter.Workbook</span><span class="p">(</span><span class="s">&#39;hello.xlsx&#39;</span><span class="p">)</span>
<span class="n">worksheet</span> <span class="o">=</span> <span class="n">workbook</span><span class="o">.</span><span class="n">add_worksheet</span><span class="p">()</span>

<span class="n">worksheet</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s">&#39;A1&#39;</span><span class="p">,</span> <span class="s">&#39;Hello world&#39;</span><span class="p">)</span>

<span class="n">workbook</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
<p>Save this to a file called <tt class="docutils literal"><span class="pre">hello.py</span></tt> and run it as follows:</p>
<div class="highlight-python"><pre>$ python hello.py</pre>
</div>
<p>This will output a file called <tt class="docutils literal"><span class="pre">hello.xlsx</span></tt> which should look something like
the following:</p>
<img alt="_static/hello01.png" src="_static/hello01.png" />
<p>If you downloaded a tarball or cloned the repo, as shown above, you should also
have a directory called
<a class="reference external" href="https://github.com/jmcnamara/XlsxWriter/tree/master/examples">examples</a>
with some sample applications that demonstrate different features of
XlsxWriter.</p>
</div>
</div>
<div class="section" id="documentation">
<h1>Documentation</h1>
<p>The full version of XlsxWriter documentation is hosted on
<a class="reference external" href="https://xlsxwriter.readthedocs.io">Read The Docs</a>. It is
also available as a
<a class="reference external" href="https://github.com/jmcnamara/XlsxWriter/raw/master/docs/XlsxWriter.pdf">PDF</a>.</p>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="#">
              <img class="logo" src="_static/logo.png" alt="Logo"/>
            </a></p>

        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
        &copy; Copyright 2013-2020, John McNamara.
    </div>
  </body>
</html>
